package com.gegewa.topic.response;

import lombok.Data;

/**
 * 数据返回类型
 * 
 * Created by dengyuanping on 2016/8/15.
 */
@Data
public class DataResponse<T> extends BaseResponse {

	/**
	 * 数据
	 */
	private T data;

	private DataResponse() {

	}

	public T getData() {
		return data;
	}

	public void setData(T data) {
		this.data = data;
	}

	public static <T> DataResponse success(T data) {
		DataResponse dataResponse = new DataResponse();
		dataResponse.setSuccess(true);
		dataResponse.setData(data);
		return dataResponse;
	}

	public static DataResponse fail(String message) {
		DataResponse dataResponse = new DataResponse();
		dataResponse.setMessage(message);
		return dataResponse;
	}

}
